﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Services;

using PMServiceDesk.BusinessLogic;
using PMServiceDesk.DataType;
using PMServiceDesk.Web.AppCode;

namespace PMServiceDesk.Web.Forms.Configuracion
{
    public partial class RegistrarCalendario : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;

            string id = Request["ID"];

            if(id == null) return;

            hiddenId.Value = id;
        }

        [WebMethod]
        public static CalendarioView CargarCalendario(string calendarioId)
        {
            return CalendarioIU.CargarCalendario(calendarioId);
        }

        [WebMethod]
        public static CalendarioView GrabarCalendario(CalendarioType registro)
        {
            return CalendarioIU.Grabar(registro);
        }

        [WebMethod]
        public static FeriadoView ListarFeriados(FeriadoType registroBusqueda, int paginaActual, int cantidadMostrar, string orderBy)
        {
            return FeriadoIU.Listar(registroBusqueda, paginaActual, cantidadMostrar, orderBy);
        }

        [WebMethod]
        public static string ExportarExcelFeriados(FeriadoType registroBusqueda, List<GridJSONField> gridFields)
        {
            return FeriadoIU.ExportarExcel(registroBusqueda,gridFields);
        }

        [WebMethod]
        public static FeriadoType CargarFeriado(string id)
        {
            return FeriadoIU.Cargar(id);
        }

        [WebMethod]
        public static FeriadoView GrabarFeriado(FeriadoType registro)
        {
            return FeriadoIU.Grabar(registro);
        }

        [WebMethod]
        public static DiaCalendarioView ListarDiasCalendario(string calendarioId)
        {
            return DiaCalendarioIU.Listar(calendarioId);
        }

        [WebMethod]
        public static string ExportarExcelDiasCalendario(string calendarioId, List<GridJSONField> gridFields)
        {
            return DiaCalendarioIU.ExportarExcel(calendarioId, gridFields);
        }

        [WebMethod]
        public static DiaCalendarioType CargarDiaCalendario(string id)
        {
            return DiaCalendarioIU.Cargar(id);
        }

        [WebMethod]
        public static DiaCalendarioView GrabarDiaCalendario(DiaCalendarioType registro)
        {
            return DiaCalendarioIU.Grabar(registro);
        }

        [WebMethod]
        public static DiaHorarioView ListarHorarios(string diaCalendarioId)
        {
            return DiaHorarioIU.Listar(diaCalendarioId);
        }

        [WebMethod]
        public static string ExportarExcelHorarios(string diaCalendarioId, List<GridJSONField> gridFields)
        {
            return DiaHorarioIU.ExportarExcel(diaCalendarioId, gridFields);
        }

        [WebMethod]
        public static DiaHorarioType CargarHorario(string id)
        {
            return DiaHorarioIU.Cargar(id);
        }

        [WebMethod]
        public static DiaHorarioView GrabarHorario(DiaHorarioType registro)
        {
            return DiaHorarioIU.Grabar(registro);
        }

        [WebMethod]
        public static string EliminarHorario(string id)
        {
            DiaHorarioIU.Eliminar(id);
            return id;
        }
    }
}